import logging

from redis import StrictRedis


class Config(object):
    DEBUG = False

    SECRET_KEY = "SHA ZI WAN YI"

    SQLALCHEMY_DATABASE_URI = "mysql://hc-jgj:mysql@127.0.0.1:3306/MyNewsManage"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    SESSION_TYPE = "redis"
    SESSION_REDIS = StrictRedis()
    SESSION_USE_SIGNER = True
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 60 * 60 * 24

    LOG_LEVEL = logging.DEBUG


class DebugConfig(Config):
    DEBUG = True


class TestConfig(Config):
    DEBUG = True
    TESTING = True


class ReleaseConfig(Config):
    LOG_LEVEL = logging.ERROR


my_config = {
    "debug": DebugConfig,
    "test": TestConfig,
    "release": ReleaseConfig
}
